package com.hwtx.form.domain.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hwtx.form.domain.def.Menu;
import com.hwtx.form.domain.def.ResourceTreeOption;
import com.hwtx.form.persistence.entity.SysFunctionResourceMapping;
import io.geekidea.boot.system.entity.SysMenu;
import io.geekidea.boot.system.query.SysMenuQuery;
import io.geekidea.boot.system.vo.PermissionVo;
import io.geekidea.boot.system.vo.SysMenuTreeVo;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 系统菜单 服务接口
 */
public interface ResourceService extends IService<SysMenu> {

    Map<Long, Long> getResourceWithPId();

    boolean containListUrl(String url);

    boolean containUniqueUrl(String url);

    List<SysMenu> getChildrenResources(Long parentId);

    /**
     * 添加系统菜单
     */
    boolean addSysMenu(SysMenu sysMenu);

    List<SysFunctionResourceMapping> getResourceUrlMapping(Collection<Long> resourceIds);

    boolean updateDataPermission(SysMenu sysMenu);

    /**
     * 修改系统菜单
     */
    boolean updateSysMenu(SysMenu sysMenu);

    /**
     * 删除系统菜单
     */
    boolean deleteSysMenu(Long id);

    /**
     * 系统菜单详情
     */
    SysMenu getMenuById(Long id);

    void deleteResMenuRel(List<Long> menIds);

    List<SysMenu> getResources(SysMenu sysMenu);

    /**
     * 获取所有的系统菜单树形列表
     */
    List<SysMenuTreeVo> getResourceTree(SysMenuQuery query);

    List<PermissionVo> getPermissions(SysMenuQuery query);

    List<ResourceTreeOption> getResourceForRoleTree(SysMenuQuery query);

    List<Menu> getResources();

    /**
     * 获取角色权限ID集合
     */
    List<Long> getMenuIdsByRoleId(Long roleId, List<Integer> types);

    Set<Long> getUserResources(Long userId, List<Integer> types);
}
